import requests
import json
web_url = "http://127.0.0.1/api"
tsessionid = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuaWNrbmFtZSI6ImtrIiwiaWQiOjMsImV4cCI6MTU1MjUzNjQxNn0.6DdEaLKV0G-9C7vJQiaf-qYsHfFnkP5krH_OtMqIFos"
headers = {
    'tsessionid': tsessionid
}
def test_sms():

    url = "{}/code/".format(web_url)
    data = {
        "mobile": "17607560047"
    }
    res = requests.post(url, json=data).json()
    print(res)

def test_register():
    url = "{}/register/".format(web_url)
    data = {
        "mobile": "17607560047",
        "code": "0701",
        "password": "liyuankun"
    }
    res = requests.post(url, json=data).json()
    print(res)


def test_change_profile():
    url = "{}/info/".format(web_url)
    res = requests.patch(url, headers=headers, json={
        "address": "珠海"
    })
    print(res.data)

if __name__ == '__main__':
    #test_sms()
    #test_register()
    test_change_profile()